package top.so.dao.impl;

import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Repository;
import top.so.dao.DraftsDao;
import top.so.dao.AbstractBaseDao;
import top.so.entity.Drafts;
import java.util.List;

@Repository
public class DraftsDaoImpl extends AbstractBaseDao implements DraftsDao  {
    public Boolean insertDrafts(Drafts drafts) {
        if(this.getSqlSession().insert(this.getClass().getName()+".insert",drafts)==1){
            return true;
        }
        return false;
    }

    public Boolean deleteDrafts(Drafts drafts) {
        if(this.getSqlSession().delete(this.getClass().getName()+".delete",drafts)==1){
            return true;
        }
        return false;
    }

    public List<Drafts> selectWithPage(Drafts drafts  , int pageNum) {
        PageHelper.startPage(pageNum,6);
        return this.getSqlSession().selectList(this.getClass().getName()+".selectAll",drafts);
    }
}
